var Message = function(){
	return{
		//提示成功信息
		success:function(msg){
			layer.msg(msg, {icon: 1}); 
		},
		//提示错误信息
		error:function(msg){
			layer.msg(msg, {icon: 2}); 
		},
		//加载信息
		waiting:function(msg){
			msg = (typeof msg == 'undefined')? '加载中' : msg;
			layer.msg(msg, {icon: 16});
		},
		//提示加载信息
		load:function(){
			var index = layer.load();
			return index;
		},
		loading:function(){
			var index = layer.load(2, {
				  shade: 0.3 //0.1透明度的白色背景
			});
			return index;
		},
		//关闭窗口,提示信息用
		close:function(index){
			layer.close(index);
		},
		//确认窗口
		confirm:function(msg,options){
			if(typeof options == 'function'){
				layer.confirm(msg, {icon: 3}, options);
			}else{
				layer.confirm(msg, {icon: 3});
			}
			
		},
		//alert信息
		alert:function(msg){
			layer.alert(msg);
		},
		//msg信息
		msg:function(msg,timeout){
			timeout = (typeof timeout == 'undefined')? 3000 : timeout*1000;
			layer.msg(msg,{time: timeout}); 
		},
		//tips
		tips:function(msg,follow,options){
			options = options || {};
			options.layout = (typeof options.layout == 'undefined')? 'right' : options.layout;
			options.tipsMore = (typeof options.tipsMore == 'undefined')? false : options.tipsMore;
			var newOptions = {};
			switch(options.layout){
				case 'up':
					options.layout = 1
					break;
				case 'down':
					options.layout = 3
					break;
				case 'left':
					options.layout = 4
					break;
				case 'right':
					options.layout = 2
					break;
				default:
					break;
			}
			
			newOptions.tips = options.layout;
			newOptions.tipsMore = options.tipsMore;
			layer.tips(msg, follow, newOptions);
		},
		//消息提示
		info: function(options) {
			if(typeof options == 'string') {
				options = { text: options };
			}
			var type = 'information';
			if(options.error) {
				type = 'error';
			}else if(options.warning) {
				type = 'alert';
			}else if(options.success) {
				type = 'success';
			}
			if(typeof options.timeout == 'undefined'){
				//默认3秒后消失
				options.timeout = 3;
			}
  			return noty({
				text: options.text,
				layout: options.layout || 'topRight',
				type: type,
				modal: options.modal,
				timeout: options.timeout * 1000,
				force: true
			});
		},
		//隐藏所有消息提示
		hideAll : function(){
			$.noty.closeAll();
		}
		
	}
}();